/* In this page, we dynamically create a list of videos on hand based upon the category of movies that the user selected, which is passed to this page via the "request.category" property. We also make each ID a link that, when clicked, rents the movie for the particular customer, indicated in the "client.id" property. Note that we have chosen to use "write()" statements to dynamically generate all of the HTML for this particular page. We could have also chosen to use backquotes to insert the dynamic text into plain HTML tags, as we have done in other pages in this application. */ project.lock(); if (request.category == null) { write("

"); } else { var userId = unscramble(client.userId) var bucket = project.sharedConnections.connections[userId] var connection = bucket.connection cursor = connection.cursor("select * from videos where videos.numonhand > 0 AND videos.category = '" + request.category + "' order by title"); write(""); write(""); write("" + "" + "" + ""); while(cursor.next()) { write(""); /* "" + cursor.title + ""); */ write(""); } // end WHILE loop write("
Videos on Hand - " + request.category + "
TitleSynopsis
" + "" + cursor.title + "" + cursor.synopsis + "

Home"); } // end if-else project.unlock();